package com.shaobufan.museum.controllar;

import com.shaobufan.museum.common.BaseResponse;
import com.shaobufan.museum.common.ResultUtils;
import com.shaobufan.museum.pojo.entity.Department;
import com.shaobufan.museum.service.DepartmentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/department")
public class DepartmentController {
    @Resource
    DepartmentService departmentService;

    @ApiOperation("获取所有部门")
    @GetMapping("/all")
    public BaseResponse<List<Department>> getAllDepartment() {
        List<Department> departmentList = departmentService.searchAllDepartment();
        return ResultUtils.success(departmentList, "所有部门");
    }
}